home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C/C++ Interactive Reference Guide
/
C-C++ Interactive Reference Guide.iso
/
c_ref
/
csource5
/
337_01
/
read.me
< prev
next >
Wrap
Text File
|
1991-01-15
|
6KB
|
154 lines
Source code
Designing Screen Interfaces in C
Yourdon Press/Prentice-Hall
This book covers the process of creating a screen/window library.
The screen/window library is then used to create various screen
interfaces such as:
-Pop-up menus.
-Moving light bar menus.
-Multi-level moving light bar menus.
-Pull-down menus.
-Data input screens (with verification).
-List selection (point & shoot /Hot key techniques).
-Directory functions.
-Context specific help screens.
-Help screen builder.
These routines are coded so that they may easily be modified and
used in your applications.
The full instructions for using this code are found in the book
and will not be duplicated here.
If you have not read the book (shame on you), I have a few
comments to help you get started.
-This code will compile under all memory models of Borland Turbo C
and Microsoft QuickC. Borland Turbo C++ users should see the
comments at the end of this document.
To specify the compiler you are using, change the first
definition found in "mydef.h" to read:
#define TURBOC
or
#define QUICKC
Note: The default is "#define TURBOC"
-The file "mydef.h" contains all function prototypes and data
structures, and should be included in all your programs which use
the library functions.
(ie: #include "mydef.h" )
-The source code for building the screen/window library are found
in the files having the specification "l_*.c". These files should
be compiled and placed in a library called "mylib.lib " for
linkage with the sample code. I have included an pre-compiled
small Turbo C library for your immediate use.
NOTE: You should compile your sample programs using the same
memory model used to create the library.
-The function main() is found in the library module l_main.c. The
sample code, and any code you create, should have the function
start(), which will be called from main(). The function start()
is the entry point for your programs.
-Turbo C project files (*.prj) are provided for each sample
program. The projects create the following programs:
BARDEMO.PRJ Sample moving light bar menu (Lotus 123 style).
BARDEMO2.PRJ Multi-level moving light bar menu.
DIR-DEMO.PRJ Directory window demo (point & shoot / Hot key).
HELPDEMO.PRJ Context specific Help screen.
IN-DEMO.PRJ Data input screen (with field editing).
LISTDEMO.PRJ List selection demo (point & shoot / Hot key).
MAKEHELP.PRJ Editor for creating help screens.
PANEL1.PRJ Demonstrates non-overlapping windows (panels).
PANEL2.PRJ "
PD-DEMO.PRJ Pull-down menu system.
POPDEMO.PRJ Pop-up menu.
TWO-WAY.PRJ Demonstrates full/partial menu selection.
WINDEMO.PRJ Demonstration of window creation/movement.
NOTE: When running all sample menus, select the option "Print",
Which opens up sub-menus. The other options, except
for "exit", do not have any real function.
Copyright (c) Information.
-----------------------------------------------------------------
You are free to use these programs in any software product you
produce as long as:
-You include a credit line in your documentation or software.
-You do not resell the screen/window library as a stand-alone
product. (You may however, charge a small processing fee for
distributing the code.)
Turbo C++ users:
-----------------------------------------------------------------
At the time I write this, I have only had my copy of Borland's
Turbo C++ for two days. From my preliminary tests it appears
that the screen/window library can be used from within a C++
program. The screen/window library (the l_*.c files), should be
compiled as normal C code and placed in a regular C library. You
can also use the precompiled library.
You should not rename the library files with the .CPP extension and
attempt to compile them as C++ code. There are no doubt conflicts
with my variable names and reserved C++ words. There may also be
different header files required. I plan to modify the code in the
near future so that it will compile as C or C++ code.
There is one small problem with linking Standard C libraries with
C++ code. The symbol table for C modules contains only the names
of the functions. In C++, the symbol name for the functions
combines the function name, argument types, etc, in a process known
as "name mangling". This process allows for better type checking
and is also known as "type safe linkage".
When the C++ tries to link in a standard C library to find the
function gotoxy() for example, it looks for the "mangled" name in
the library and does not find it. The compiler reports a
"undefined symbol" message.
Fortunately you can over ride the name mangling function as
follows:
In your C++ code, when you include the "mydef.h" file, use the
following statement:
extern "C" {
#include "mydef.h"
}
This tells the compiler that the functions defined by the
prototypes found in "mydef.h", should be linked using the standard
"C" type symbol names.
One other thing you must do is place the name of the screen/window
library (mylib.lib ) at the beginning of your project file when in
the IDE environment. If you fail to do so, you will get an error
message that the compiler was unable to find main().
This appears to occur because the function main() is found in
"mylib.lib" and not in the C++ code.
Jim Pinson 1/15/1991
CompuServe 73427,2424